package com.example.注解和反射.reflection;

public class Test06 {
    public static void main(String[] args) throws ClassNotFoundException {

        //获取系统加载器
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);

        //获取系统类加载器的父类加载器--》扩展类加载器
        ClassLoader parent = systemClassLoader.getParent();
        System.out.println(parent);

        //获取扩展类加载器的父类加载器--》根加载器(c/c++)
        ClassLoader parent1 = parent.getParent();
        System.out.println(parent1);

        //测试当前类是那个加载器加载的
        ClassLoader classLoader = Class.forName("com.example.注解和反射.reflection.Test06").getClassLoader();
        System.out.println(classLoader);

        //测试JDK内部类是那个加载器加载的
        classLoader = Class.forName("java.lang.Object").getClassLoader();
        System.out.println(classLoader);

        System.out.println(System.getProperty("java.class.path"));
    }
}
